package com.xz;

import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

/**
 * @author XZ
 * @create 2021-12-26 22:00
 */
public class TestPassword {
    public static void main(String[] args) {
        BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder();
        String encode = bCryptPasswordEncoder.encode("123");
        System.out.println(encode);
        //"123"加密后的密码
        //$2a$10$PQgV9JqgvSnV/lqoyl/lJ.W6kKoZ47r3RI4gCUqOy/zztsrWRvksq
        //$2a$10$CYeHPjoyBQ3.KGe0RlpQPeezMRxg8T8.0iSfojrLjw2j7oRe7ueoq
        //$2a$10$2IU5rcg72ntviPnscApVXubNdlwI6dwq.cJ.2pOYCSvXuO96a3MOe
        //$2a$10$hFDJx7G3IiqzqpvKTxmLQug82HHWY3WdX6CO84sbylFgr2R9WapWK
        boolean matches = bCryptPasswordEncoder.matches("123", "$2a$10$CYeHPjoyBQ3.KGe0RlpQPeezMRxg8T8.0iSfojrLjw2j7oRe7ueoq");
        System.out.println(matches);
    }
}
